package com.wanxi.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;

public class MyCollection {
    public static void main(String[] args) {
        Collection<String> collection = new ArrayList();
        collection.add("aa");
        collection.add("aa");
        collection.add("bb");
        collection.add("bb");
        System.out.println(collection);


//        collection.removeIf(new Predicate<String>() {
//            @Override
//            public boolean test(String s) {
//                if ("aa".equals(s)) {
//                    return true;
//                }
//                return false;
//            }
//        });
//        collection.removeIf(s->"aa".equals(s));
//        collection.clear();
        boolean aa = collection.contains("aa");
        System.out.println(aa+"+++++++");
        collection.clear();
        boolean empty = collection.isEmpty();
        System.out.println(empty+"-------------");
        System.out.println(collection.size());
        System.out.println(collection);

//        List<String> list=new ArrayList<>();
//        list.add("bb");
////        remove(1)是list里面的方法
//        list.remove(1);
//        list.remove("bb");

    }
}
